﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/AdminMaster.Master" AutoEventWireup="true" CodeBehind="MenuManager.aspx.cs" Inherits="ShowRoom.admin.MenuManager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div style="width:100%;text-align:center;color:#C794BA;font-weight:bold;margin-bottom:10px;padding-top:15px;"><asp:Label ID="lblTil" runat="server" Text="QUẢN LÝ MENU ADMIN"></asp:Label></div>
    <table id="tbl" runat="server" width="100%" style="height: 40px; border-color: #E1E1E1;
        border-collapse: collapse;" border="1" cellpadding="1" cellspacing="2">
        <tr>            
            <td style="width: 10%;border-right:1px solid #E1E1E1;text-align:center" align="center">
                <asp:Label ID="lblName" runat="server" Text="Tên menu "></asp:Label>:
            </td>
            <td style="width: 30%;text-align:center;border-right:1px solid #E1E1E1">
                <asp:TextBox ID="txtMenuName" runat="server"  CssClass="cssTextBox" Width="96%"></asp:TextBox>
            </td>
            <td style="width: 10%;border-right:1px solid #E1E1E1;text-align:center" align="center">
                <asp:Label ID="Label1" runat="server" Text="Ẩn/ hiện"></asp:Label>:
                </td>
            <td style="width: 30%;text-align:center;border-right:1px solid #E1E1E1">
                  <asp:DropDownList ID="ddlActive" runat="server" Width="200px" CssClass="cssDropDown">
                        <asp:ListItem Value="">--All--</asp:ListItem>
                        <asp:ListItem Value="Y">Hiện</asp:ListItem>
                        <asp:ListItem Value="N">Ẩn</asp:ListItem>
                    </asp:DropDownList>                    
            </td>
            <td style="width: 10%;border-right:1px solid #E1E1E1;text-align:center">
                <asp:ImageButton ID="imgSerach" runat="server" Width="50px" 
                    ImageUrl="img/btnSear.png" onclick="imgSerach_Click" />
            </td>
        </tr>       
    </table>
    <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin-top:15px">
        <tr>
            <td align="left">
              
            </td> 
            <td align="right">              
                <a style="cursor:pointer" onclick="AddMenuAdmin();">Thêm mới menu</a>
                
            </td>
        </tr>
    </table>
    
    <div style="width: 100%; float: left; margin-top: 10px;">
        <asp:GridView ID="gvMenu" runat="server" Width="100%" BorderWidth="1px" 
            BorderColor="#CCCCCC" AutoGenerateColumns="false" DataKeyNames="mn_id" 
            onrowdatabound="gvMenu_RowDataBound" >
            <HeaderStyle BackColor="#E1E1E1" BorderWidth="1px" BorderColor="#CCCCCC" Height="33px" Font-Bold="True" ForeColor="black" />
            <EditRowStyle BorderColor="Silver" BorderWidth="1px" Height="25px" />
            <AlternatingRowStyle BorderColor="" BorderWidth="1px"/>
            <RowStyle BorderColor="#E1E1E1" BorderWidth="1px" Height="25px" BackColor="white" />
            <EmptyDataRowStyle BorderColor="Silver" BorderWidth="1px" />
            <PagerStyle BorderStyle="None"></PagerStyle>
            <PagerSettings Visible="false" />
            <Columns>
                <asp:TemplateField HeaderText="stt" ItemStyle-HorizontalAlign="center" ItemStyle-Width="7%" HeaderStyle-Width="7%">
                    <ItemTemplate>
                        <%# Container.DataItemIndex + 1 %>
                    </ItemTemplate>                           
                </asp:TemplateField>                                                
                  <asp:TemplateField HeaderText="Tên menu" ItemStyle-Height="30px" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#E1E1E1"  ItemStyle-HorizontalAlign="Center"> 
                     <ItemTemplate>                                         
                         <asp:Label ID="lblTenMenu" runat="server" Text='<%# Bind("mn_nm") %>'></asp:Label>                                              
                    </ItemTemplate>
                </asp:TemplateField>
                  <asp:TemplateField HeaderText="Link"  ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#E1E1E1"  ItemStyle-HorizontalAlign="Center"> 
                     <ItemTemplate >                                         
                         <asp:Label ID="lbllink" runat="server" Text='<%# Bind("link") %>' ></asp:Label>                                              
                    </ItemTemplate>
                </asp:TemplateField> 
                <asp:TemplateField HeaderText="active"  ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#E1E1E1" ItemStyle-HorizontalAlign="Center"> 
                     <ItemTemplate >                                         
                         <asp:Label ID="lblactive" runat="server" Text='<%# Bind("status") %>' ></asp:Label>                                              
                    </ItemTemplate>
                </asp:TemplateField> 
                 
                 <asp:TemplateField HeaderText="Quản lý" ItemStyle-BorderWidth="1px" ItemStyle-BorderColor="#E1E1E1"  ItemStyle-Wrap="false" HeaderStyle-Wrap="false" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="center" ItemStyle-Width="10%" HeaderStyle-Width="10%">
                      <ItemTemplate>                                                
                         <asp:Image ID="imgEdit" runat="server" ImageUrl="img/modify.gif" /> 
                          <asp:Image ID="imgDelete" runat="server" ImageUrl="img/delete.gif" />      
                            <asp:Literal ID="litView" runat="server" Text="</td></tr><tr style='display:none'><td colspan='10' align='center'>"></asp:Literal>                                                                                 
                     </ItemTemplate>             
                 </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
     <input id="txtDeleteMenuAdmin" type="hidden" name="txtDeleteMenuAdmin" runat="server" />
     <script type="text/javascript">
         function AddMenuAdmin() {
             window.open("AddMenu.aspx?", null, 'status=no, scroll=no, toolbar=no,width=450px,height=200px,Left=250px,Top=150px');
         }
         function EditMenuAdmin(mn_id) {
             window.open("AddMenu.aspx?mn_id=" + mn_id, null, 'status=no, scroll=no, toolbar=no,width=450px,height=200px,Left=250px,Top=150px');
         }
         function setBk(itemGrid) {
             currentColor = itemGrid.style.backgroundColor;
             itemGrid.style.backgroundColor = "#FFFFCC";
         }

         function setBkOut(itemGrid) {
             itemGrid.style.backgroundColor = currentColor;
         }
         //xóa menu
         function CheckDeletemenuManager(mn_id) {
             var result = confirm("Bạn có muốn xóa menu này ? ");
             if (result == true) {
                 var txt = document.getElementById("<%=txtDeleteMenuAdmin.ClientID%>");
                 txt.value = "";
                 txt.value = mn_id;
                 form1.submit();
             }
             else {
                 return false;
             }
         }
     </script>
</asp:Content>
